<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue-extend</title>
    <link rel="stylesheet" href="../../../assets/css/bootstrap.min.css">
    <script src="../../../assets/js/vue-2.5.6.js"></script>
</head>

<body>
    <div id="app">

    </div>
</body>
<script>
    //在构造器外部声明数据
    var outData = {
        count: 1,
        goodName: 'car'
    };

    function add() {
        Vue.set(outData, 'count', 4);
        app.count++;
        outData.count++;
    }
    var app = new Vue({
        el: '#app',
        //引用外部数据
        data: outData
    });
</script>

</html>